<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>验证安全问题</title>
    <style>
        :root {
            --primary-color: #ff6a00;
            --text-dark: #1f2d3d;
            --success-color: #52c41a;
            --error-color: #ff4d4f;
            --background-light: #f5f7fa;
        }
        .ant-container {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 24px;
            background: var(--background-light);
        }
        .ant-card {
            background: white;
            padding: 48px;
            border-radius: 12px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.08);
            max-width: 560px;
            width: 100%;
        }
        .ant-title {
            color: var(--text-dark);
            font-size: 28px;
            margin-bottom: 32px;
            text-align: center;
            font-weight: 600;
        }
        .ant-form {
            display: flex;
            flex-direction: column;
            gap: 24px;
        }
        .form-group {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .ant-label {
            color: var(--text-dark);
            font-size: 16px;
            font-weight: 500;
        }
        .ant-input {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e4e7ed;
            border-radius: 6px;
            font-size: 16px;
            transition: border-color 0.3s;
        }
        .ant-input:focus {
            border-color: var(--primary-color);
            outline: none;
        }
        .ant-btn {
            padding: 16px 32px;
            background: var(--primary-color);
            border: none;
            color: white;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            transition: background 0.3s;
        }
        .ant-btn:hover {
            background: #e65c00;
        }
        .ant-message {
            margin-bottom: 24px;
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            text-align: center;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
            animation: fadeIn 0.3s ease-in;
        }
        .ant-message-error {
            background: #fff1f0;
            border: 1px solid #ffa39e;
            color: var(--error-color);
        }
        .ant-message-success {
            background: #f6ffed;
            border: 1px solid #b7eb8f;
            color: var(--success-color);
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }
    </style>
</head>
<body>
<div class="ant-container">
    <div class="ant-card">
        <h2 class="ant-title">验证安全问题</h2>
        {% if messages %}
            {% for message in messages %}
                <div class="ant-message {% if message.tags == 'success' %}ant-message-success{% else %}ant-message-error{% endif %}">
                    {{ message }}
                </div>
            {% endfor %}
        {% endif %}
        <form method="post" action="{% url 'password_reset_verify' %}" class="ant-form">
            {% csrf_token %}
            <input type="hidden" name="username" value="{{ username }}">
            <div class="form-group">
                <label class="ant-label">安全问题</label>
                <p>{{ security_question }}</p>
            </div>
            <div class="form-group">
                <label for="security_answer" class="ant-label">答案</label>
                <input type="text" id="security_answer" name="security_answer" class="ant-input" required>
            </div>
            <div class="form-group">
                <label for="new_password" class="ant-label">新密码</label>
                <input type="password" id="new_password" name="new_password" class="ant-input" required>
            </div>
            <div class="form-group">
                <label for="new_password2" class="ant-label">确认新密码</label>
                <input type="password" id="new_password2" name="new_password2" class="ant-input" required>
            </div>
            <button type="submit" class="ant-btn">重置密码</button>
        </form>
    </div>
</div>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        const messages = document.querySelectorAll('.ant-message');
        messages.forEach(message => {
            setTimeout(() => {
                message.style.transition = 'opacity 0.5s';
                message.style.opacity = '0';
                setTimeout(() => message.remove(), 500);
            }, 5000); // 延长到5秒后消失
        });
    });
</script>
</body>
</html>